﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    var proPic = ViewBag.ProPic as List<BuyWithoutLoseMoney.Core.Models.ProductPic>;
    var proType = ViewBag.ProType as List<BuyWithoutLoseMoney.Core.Models.ProductType>;
    var position = ViewBag.Position as List<ResPosition>;
}
@model IEnumerable<Product>;

<!--=== home ===-->
<section id="home" class="header-intro-1 d-flex align-items-center">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="header-intro-wrap text-center">
                    <div class="header-intro-title"><h1>买不亏网站</h1></div>
                    <div class="header-intro-tag">拥有良好的购物体验</div>
                    <div><a href="#" class="btn btn-primary main-btn bg-main">开始</a></div>
                </div>
            </div>
        </div>
    </div>
</section>
<section class="blog-posts">
    <div class="container">
        <div class="row">
            <div class="col">
                <div class="row">
                    <div class="col-12">
                        <div class="section-header">
                            <div class="sec-icon"><i class="ion ion-android-list"></i></div>
                            <div class="sec-title">每日推荐</div>
                        </div>
                    </div>
                    @foreach (var pos in position.Where(x => x.PositionId == 3).Take(3))
                    {
                        @foreach (var item in Model.Where(x => x.Status == 1 &&x.Id== @pos.ResId ))
                        {
                            <div class="col-lg-4 col-md-6 col-sm-6">
                                <div class="blog-post" style="height:400px">
                                    <div class="post-img">
                                        @foreach (var pic in proPic.Where(x => x.ProductId == @item.Id && x.PicType == 1))
                                        {
                                            @*<img src="@pic.PicAddress" style="border-radius: 15px;" class="image" width="200px" height="150px">*@
                                            <img src="@pic.PicAddress" alt="Product Item" width="100%" height="220px" />
                                        }
                                    </div>
                                    <div class="blog-details">
                                        <ul class="list-inline blog-item-links">
                                            <li class="list-inline-item"><a href="#"><i class="ion ion-person"></i>@item.Brand</a></li>
                                        </ul>
                                        <a href="blog-post.html"><h4 class="media-heading">@item.Title</h4></a>
                                        <a href="/products/prodetails/@item.Id" class="blog-post-link" style="float:right;font-size:20px">查看详情 <i class="fa fa-angle-double-right"></i></a>
                                    </div>
                                </div>
                            </div>
                        }
                    }

                </div>
            </div>
        </div>
    </div>
</section>


<!--=== Products ===-->
<section class="products">
    <div class="container">
        <div class="row">
            <div class="col-12">
                <div class="section-header">
                    <div class="sec-icon"><i class="ion ion-android-list"></i></div>
                    <div class="sec-title">特色商品</div>
                </div>
            </div>
            @foreach (var pos in position.Where(x => x.PositionId == 2).Take(6))
            {
                @foreach (var item in Model.Where(x => x.Status == 1 && x.Id == @pos.ResId))
                {

                    <div class="col-lg-4 col-md-4 col-sm-6">
                        <div class="product-wrap" style="height:200px">
                            <div class="img-wrap">
                                @foreach (var pic in proPic.Where(x => x.ProductId == @item.Id && x.PicType == 1))
                                {
                                    @*<img src="@pic.PicAddress" style="border-radius: 15px;" class="image" width="200px" height="150px">*@
                                    <img src="@pic.PicAddress" alt="Product Item" width="100%" height="150px" />
                                }
                                <div class="product-overlay">
                                    <a href="/products/prodetails/@item.Id" class="icon-wrap"><i class="ion ion-android-cart"></i></a>
                                </div>
                            </div>
                        </div>
                    </div>
                }
            }

        </div>
    </div>
</section>
